/*
 *  $Id: Sprite.cs 1095 2010-05-25 13:56:04Z thenn.erannor $
 *	This file is a part of Ragima CCG.
 *	(C) 2008-2009 Ragima development group.
 *
 *	Licensed under the terms of the GNU GPL License version 2.
 *
 */

using AgateLib.DisplayLib;
using AgateLib.Geometry;

namespace Ragima.UI {
    /// <summary>
    /// Отдельный экземпляр спрайта, определяемый изображением и описателем спрайтов.
    /// </summary>
    public class Sprite {
        private Surface _surface;
        private SpriteDescriptor _descriptor;

        public Sprite(Surface surface, SpriteDescriptor descriptor) {
            _surface = surface;
            _descriptor = descriptor;
        }

        public Surface Surface {
            get { return _surface; }
        }

        public SpriteDescriptor Descriptor {
            get { return _descriptor; }
        }

        public void Draw(int number, Point point) {
            _descriptor.Draw(number, _surface, point);
        }
        public void Draw(int number, int x, int y) {
            _descriptor.Draw(number, _surface, x, y);
        }

        public Surface CarveSubSurface(int number) {
            return _surface.CarveSubSurface(_descriptor.GetRect(number));
        }
    }
}
